Optimal. Leaf size=103 \[ \frac {a^2 (3 c+2 d) \tanh ^{-1}(\sin (e+f x))}{2 f}+\frac {2 a^2 (3 c+2 d) \tan (e+f x)}{3 f}+\frac {a^2 (3 c+2 d) \sec (e+f x) \tan (e+f x)}{6 f}+\frac {d (a+a \sec (e+f x))^2 \tan (e+f x)}{3 f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.08, antiderivative size = 103, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 6, integrand size = 29, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.207, Rules used = {4086, 3873,
3852, 8, 4131, 3855} \begin {gather*} \frac {2 a^2 (3 c+2 d) \tan (e+f x)}{3 f}+\frac {a^2 (3 c+2 d) \tanh ^{-1}(\sin (e+f x))}{2 f}+\frac {a^2 (3 c+2 d) \tan (e+f x) \sec (e+f x)}{6 f}+\frac {d \tan (e+f x) (a \sec (e+f x)+a)^2}{3 f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 3852
Rule 3855
Rule 3873
Rule 4086
Rule 4131
Rubi steps
\begin {align*} \int \sec (e+f x) (a+a \sec (e+f x))^2 (c+d \sec (e+f x)) \, dx &=\frac {d (a+a \sec (e+f x))^2 \tan (e+f x)}{3 f}+\frac {1}{3} (3 c+2 d) \int \sec (e+f x) (a+a \sec (e+f x))^2 \, dx\\ &=\frac {d (a+a \sec (e+f x))^2 \tan (e+f x)}{3 f}+\frac {1}{3} (3 c+2 d) \int \sec (e+f x) \left (a^2+a^2 \sec ^2(e+f x)\right ) \, dx+\frac {1}{3} \left (2 a^2 (3 c+2 d)\right ) \int \sec ^2(e+f x) \, dx\\ &=\frac {a^2 (3 c+2 d) \sec (e+f x) \tan (e+f x)}{6 f}+\frac {d (a+a \sec (e+f x))^2 \tan (e+f x)}{3 f}+\frac {1}{2} \left (a^2 (3 c+2 d)\right ) \int \sec (e+f x) \, dx-\frac {\left (2 a^2 (3 c+2 d)\right ) \text {Subst}(\int 1 \, dx,x,-\tan (e+f x))}{3 f}\\ &=\frac {a^2 (3 c+2 d) \tanh ^{-1}(\sin (e+f x))}{2 f}+\frac {2 a^2 (3 c+2 d) \tan (e+f x)}{3 f}+\frac {a^2 (3 c+2 d) \sec (e+f x) \tan (e+f x)}{6 f}+\frac {d (a+a \sec (e+f x))^2 \tan (e+f x)}{3 f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(481\) vs. \(2(103)=206\).
time = 6.30, size = 481, normalized size = 4.67 \begin {gather*} \frac {a^2 \cos ^3(e+f x) \sec ^4\left (\frac {1}{2} (e+f x)\right ) (1+\sec (e+f x))^2 (c+d \sec (e+f x)) \left (-6 (3 c+2 d) \log \left (\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right )+6 (3 c+2 d) \log \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )+\frac {2 d \sin \left (\frac {f x}{2}\right )}{\left (\cos \left (\frac {e}{2}\right )-\sin \left (\frac {e}{2}\right )\right ) \left (\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right )^3}+\frac {(3 c+7 d) \cos \left (\frac {e}{2}\right )-(3 c+5 d) \sin \left (\frac {e}{2}\right )}{\left (\cos \left (\frac {e}{2}\right )-\sin \left (\frac {e}{2}\right )\right ) \left (\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right )^2}+\frac {4 (6 c+5 d) \sin \left (\frac {f x}{2}\right )}{\left (\cos \left (\frac {e}{2}\right )-\sin \left (\frac {e}{2}\right )\right ) \left (\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right )}+\frac {2 d \sin \left (\frac {f x}{2}\right )}{\left (\cos \left (\frac {e}{2}\right )+\sin \left (\frac {e}{2}\right )\right ) \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )^3}-\frac {(3 c+7 d) \cos \left (\frac {e}{2}\right )+(3 c+5 d) \sin \left (\frac {e}{2}\right )}{\left (\cos \left (\frac {e}{2}\right )+\sin \left (\frac {e}{2}\right )\right ) \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )^2}+\frac {4 (6 c+5 d) \sin \left (\frac {f x}{2}\right )}{\left (\cos \left (\frac {e}{2}\right )+\sin \left (\frac {e}{2}\right )\right ) \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )}\right )}{48 f (d+c \cos (e+f x))} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.24, size = 145, normalized size = 1.41
method | result | size |
derivativedivides | \(\frac {a^{2} c \left (\frac {\sec \left (f x +e \right ) \tan \left (f x +e \right )}{2}+\frac {\ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )}{2}\right )-a^{2} d \left (-\frac {2}{3}-\frac {\left (\sec ^{2}\left (f x +e \right )\right )}{3}\right ) \tan \left (f x +e \right )+2 a^{2} c \tan \left (f x +e \right )+2 a^{2} d \left (\frac {\sec \left (f x +e \right ) \tan \left (f x +e \right )}{2}+\frac {\ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )}{2}\right )+a^{2} c \ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )+a^{2} d \tan \left (f x +e \right )}{f}\) | \(145\) |
default | \(\frac {a^{2} c \left (\frac {\sec \left (f x +e \right ) \tan \left (f x +e \right )}{2}+\frac {\ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )}{2}\right )-a^{2} d \left (-\frac {2}{3}-\frac {\left (\sec ^{2}\left (f x +e \right )\right )}{3}\right ) \tan \left (f x +e \right )+2 a^{2} c \tan \left (f x +e \right )+2 a^{2} d \left (\frac {\sec \left (f x +e \right ) \tan \left (f x +e \right )}{2}+\frac {\ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )}{2}\right )+a^{2} c \ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )+a^{2} d \tan \left (f x +e \right )}{f}\) | \(145\) |
norman | \(\frac {\frac {8 a^{2} \left (3 c +2 d \right ) \left (\tan ^{3}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{3 f}-\frac {a^{2} \left (3 c +2 d \right ) \left (\tan ^{5}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}-\frac {a^{2} \left (5 c +6 d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{f}}{\left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )^{3}}-\frac {a^{2} \left (3 c +2 d \right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}{2 f}+\frac {a^{2} \left (3 c +2 d \right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}{2 f}\) | \(149\) |
risch | \(-\frac {i a^{2} \left (3 c \,{\mathrm e}^{5 i \left (f x +e \right )}+6 d \,{\mathrm e}^{5 i \left (f x +e \right )}-12 c \,{\mathrm e}^{4 i \left (f x +e \right )}-6 d \,{\mathrm e}^{4 i \left (f x +e \right )}-24 \,{\mathrm e}^{2 i \left (f x +e \right )} c -24 d \,{\mathrm e}^{2 i \left (f x +e \right )}-3 \,{\mathrm e}^{i \left (f x +e \right )} c -6 d \,{\mathrm e}^{i \left (f x +e \right )}-12 c -10 d \right )}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{3}}+\frac {3 a^{2} c \ln \left ({\mathrm e}^{i \left (f x +e \right )}+i\right )}{2 f}+\frac {a^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}+i\right ) d}{f}-\frac {3 a^{2} c \ln \left ({\mathrm e}^{i \left (f x +e \right )}-i\right )}{2 f}-\frac {a^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}-i\right ) d}{f}\) | \(214\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.29, size = 181, normalized size = 1.76 \begin {gather*} \frac {4 \, {\left (\tan \left (f x + e\right )^{3} + 3 \, \tan \left (f x + e\right )\right )} a^{2} d - 3 \, a^{2} c {\left (\frac {2 \, \sin \left (f x + e\right )}{\sin \left (f x + e\right )^{2} - 1} - \log \left (\sin \left (f x + e\right ) + 1\right ) + \log \left (\sin \left (f x + e\right ) - 1\right )\right )} - 6 \, a^{2} d {\left (\frac {2 \, \sin \left (f x + e\right )}{\sin \left (f x + e\right )^{2} - 1} - \log \left (\sin \left (f x + e\right ) + 1\right ) + \log \left (\sin \left (f x + e\right ) - 1\right )\right )} + 12 \, a^{2} c \log \left (\sec \left (f x + e\right ) + \tan \left (f x + e\right )\right ) + 24 \, a^{2} c \tan \left (f x + e\right ) + 12 \, a^{2} d \tan \left (f x + e\right )}{12 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.17, size = 146, normalized size = 1.42 \begin {gather*} \frac {3 \, {\left (3 \, a^{2} c + 2 \, a^{2} d\right )} \cos \left (f x + e\right )^{3} \log \left (\sin \left (f x + e\right ) + 1\right ) - 3 \, {\left (3 \, a^{2} c + 2 \, a^{2} d\right )} \cos \left (f x + e\right )^{3} \log \left (-\sin \left (f x + e\right ) + 1\right ) + 2 \, {\left (2 \, a^{2} d + 2 \, {\left (6 \, a^{2} c + 5 \, a^{2} d\right )} \cos \left (f x + e\right )^{2} + 3 \, {\left (a^{2} c + 2 \, a^{2} d\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{12 \, f \cos \left (f x + e\right )^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} a^{2} \left (\int c \sec {\left (e + f x \right )}\, dx + \int 2 c \sec ^{2}{\left (e + f x \right )}\, dx + \int c \sec ^{3}{\left (e + f x \right )}\, dx + \int d \sec ^{2}{\left (e + f x \right )}\, dx + \int 2 d \sec ^{3}{\left (e + f x \right )}\, dx + \int d \sec ^{4}{\left (e + f x \right )}\, dx\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.51, size = 178, normalized size = 1.73 \begin {gather*} \frac {3 \, {\left (3 \, a^{2} c + 2 \, a^{2} d\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1 \right |}\right ) - 3 \, {\left (3 \, a^{2} c + 2 \, a^{2} d\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1 \right |}\right ) - \frac {2 \, {\left (9 \, a^{2} c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} + 6 \, a^{2} d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} - 24 \, a^{2} c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 16 \, a^{2} d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} + 15 \, a^{2} c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 18 \, a^{2} d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 1\right )}^{3}}}{6 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 4.52, size = 161, normalized size = 1.56 \begin {gather*} \frac {2\,a^2\,\mathrm {atanh}\left (\frac {4\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\left (\frac {3\,c}{2}+d\right )}{6\,c+4\,d}\right )\,\left (\frac {3\,c}{2}+d\right )}{f}-\frac {\left (3\,a^2\,c+2\,a^2\,d\right )\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^5+\left (-8\,a^2\,c-\frac {16\,a^2\,d}{3}\right )\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^3+\left (5\,a^2\,c+6\,a^2\,d\right )\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}{f\,\left ({\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^6-3\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^4+3\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2-1\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________